<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${pageObj.number}" />
	<input type="hidden" name="viewRequest.size" value="${pageObj.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
	
	<input type="hidden" name="memberName" value="${memberName}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return orders_navSearch(this);" action="${rootUrl}/order/orders" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 60px">
			<li>
				<label>订单编号：</label>
				<input type="text" name="viewRequest.params['o_dot_code_like']" value="${viewRequest.params.o_dot_code_like}"/>
			</li>
			<li style="width: 500px">
				<label>下单时间：</label>
				<input name="viewRequest.params['_and_o_dot_createdAt_ge_string']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_createdAt_ge_string'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_o_dot_createdAt_le_string']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_createdAt_le_string'] }" placeholder="结束时间"/>
			</li>
			<li style="width: 500px">
				<label>支付时间：</label>
				<input name="viewRequest.params['_and_o_dot_payTime_ge_string']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_payTime_ge_string'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_o_dot_payTime_le_string']" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss" size="20" value="${viewRequest.params['_and_o_dot_payTime_le_string'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>下单用户：</label>
				<input type="hidden" id="orderMemberId" name="member.id" value="${viewRequest.params._and_m_dot_id_eq_string}"/>
				<input type="text" id="orderMemberName" name="member.name" style="float:left" value="${memberName}"/>
				<a class="btnLook" href="${rootUrl}/member/member/1/dialog" width="800" height="720" lookupGroup="member">会员</a>
			</li>
			<li>
				<label>支付单号：</label>
				<input type="text" name="viewRequest.params['_and_o_dot_payCode_like']" value="${viewRequest.params._and_o_dot_payCode_like}"/>
			</li>
			<li>
				<label>订单状态：</label>
				<select name="viewRequest.params['_and_g_dot_state_eq_string']">
					<option value="" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<c:forEach var="item" items="${orderState}">   
						<option value="${item.key}" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>
				</select>
			</li>
			<li>
				<label>支付方式：</label>
				<select name="viewRequest.params['_and_o_dot_payChannel_eq_string']">
						<option value="" <c:if test="${viewRequest.params._and_o_dot_payChannel_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<c:forEach var="item" items="${payChannel}">   
						<option value="${item.key}" <c:if test="${viewRequest.params._and_o_dot_payChannel_eq_string == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>
				</select>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar" >
		<ul class="toolBar">
			<li><a title="要批量确认这些订单吗?" target="selectedTodo" targetType="navTab" rel="ids" href="${rootUrl}/order/orders!confirmBatch" class="icon"><span>确认订单</span></a></li>
		<%-- 	<li><a class="edit"  href="${rootUrl}/order/orders/{data_id}/edit" target="dialog" width="1320" height="720" rel="article_edit" title="修改"><span>修改</span></a></li> --%>
			<li class="line">line</li>
			<!-- <li><a class="icon" href="demo/common/dwz-team.xls" target="dwzExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li> -->
		</ul>
	</div>
	<table class="table" targetType="navTab"  width="100%" layoutH="170">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th width="30" align="center" >序号</th>
				<th width="100">订单编号</th>
				<th width="100">买家</th>
				<th width="150">支付单号</th>
				<th width="70">支付渠道</th>
				<th width="120">下单时间</th>
				<th width="120">支付时间</th>
				<th width="50">商品金额</th>
				<th width="50">优惠金额</th>
				<th width="50">订单金额</th>
				<th width="50">运费金额</th>
				<th width="50">应付金额</th>
				<th width="50">退款金额</th>
				<th width="100">订单状态</th>
				<th width="100">完成时间</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${pageObj.content}" var="orders" varStatus="status">
			<tr target="data_id" rel="${orders[0]}">
				<td><input name="ids" value="${orders[0]}" type="checkbox"></td>
				<td>${status.count}</td>
				<td>${orders[1]}</td>
				<td>${orders[14]}</td>
				<td>${orders[2]}</td>
				<td>${payChannel[orders[3]]}</td>
				<td><fmt:formatDate value="${orders[5]}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${orders[4]}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[6]/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[7]/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[8]/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[9]/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[10]/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${orders[11]/100}" pattern="0.00"/></td>
				<td>${orderState[orders[13]]}</td>
				<td><fmt:formatDate value="${orders[12]}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>
				    <a title="订单详情" target="dialog"  max="true" rel="orders_show" href="${rootUrl}/order/orders/${orders[0]}/edit" class="btnView">订单详情</a>
				    <%-- <a title="订单维护" target="dialog"  max="true" rel="orders_show" href="${rootUrl}/order/orders/${orders[0]}/mana" class="btnEdit">订单维护</a> --%>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${pageObj.size}">${pageObj.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${pageObj.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${pageObj.totalElements}" numPerPage="${pageObj.size}" pageNumShown="10" currentPage="${pageObj.number}"></div>
	</div>
</div>
<script>
	function orders_navSearch(obj){
		$("#orderMemberId").attr("name","viewRequest.params['_and_m_dot_id_eq_string']");
		$("#orderMemberName").attr("name","memberName");
		if($("#orderMemberName").val() == ""){
			$("#orderMemberId").val("");
		}
		return navTabSearch(obj);
	}
</script>